/*
 * @Author: zhang_gen_yuan
 * @Date: 2021-06-12 14:46:32
 * @LastEditTime: 2021-06-12 16:02:25
 * @Descripttion: 
 */

interface State{
    token:string
}
export default {
    namespaced:true,
    state:{
        token:''
    },
    mutations:{
        setToken:(state:State,payload:string):void=>{
            state.token = payload;
        },
        clearToken:(state:State):void=>{
            state.token = '';
        }
    },
    actions:{
        setToken({ commit },payload:string){
            return new Promise((resolve)=>{
                commit('setToken',payload);
                resolve(true)
            })
        },
        clearToken({ commit }){
            return new Promise(resolve=>{
                commit('clearToken');
                resolve(true)
            })
        }
    }
}